﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DAO
{
    public static class NhanVienDAO
    {
        public static bool dangNhap(int maNV, string matKhau)
        {
            bool ok = false;
            QL_HuongRungEntities db = new QL_HuongRungEntities();
            NHANVIEN nv = db.NHANVIEN.Find(maNV);
            if (nv != null)
            {
                if (nv.MatKhau == matKhau)
                {
                    //loại nv
                    int loaiNV = nv.LoaiNV;

                    switch (loaiNV)
                    {
                        case 1:
                            ok = true;
                            break;
                        case 2:
                            ok = true;
                            break;
                        case 3:
                            ok = true;
                            break;
                        case 4:
                            ok = true;
                            break;
                        case 5:
                            ok = true;
                            break;
                        default:
                            ok = false;
                            break;
                    }
                }
            }
            return ok;
        }

        public static NHANVIEN layNV(int maNV)
        {
            QL_HuongRungEntities db = new QL_HuongRungEntities();
            NHANVIEN nv = new NHANVIEN();
            nv = db.NHANVIEN.Find(maNV);
            return nv;
        }
    }
}
